<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>帮助提示</title>
    <script type="text/javascript" src="/script/mootools.js"></script>
    <script type="text/javascript" src="/script/mootools-more.js"></script>
    <link rel="stylesheet" type="text/css" href="/script/jspxnet-ui.css"/>
    <script type="text/javascript" src="/script/jspxnet.js"></script>
    <script type="text/javascript" src="/script/jspxnet-ui-roc.js"></script>
    <link href="/share/mskin/default/devcenter.css" rel="stylesheet" type="text/css"/>
    <script src="/script/vue.js"></script>
    <style>
        [v-cloak] {
            display: none;
        }
    </style>
</head>
<body>
<div class="formContainer mWrap">
    <div class="mTitPanel addBoardLogo">
        帮助提示
    </div>
    <div class="addConPanel mConPanel">
        <div id="helpTip"></div>
        <form id="helpTipForm" v-cloak>
                        <div class="row">
                            <label class="tit" for="docType">文档类型</label>
                            <div class="con">
                                <select name="docType" id="docType" v-model="docType">
                                        <option value="0">HTML</option>
                                        <option value="1">MARKDOWN</option>
                                        <option value="2">LINK</option>
                                        <option value="3">BASE64</option>
                                </select>
                                <span id="docTypeMsg" class="note"></span>
                            </div>
                        </div>
                    <div class="row">
                        <label class="tit" for="title">标题</label>
                        <div class="con">
                            <input id="title" name="title" type="text" class="calendar" v-model:value="title"/>
                            <span id="titleMsg" class="note"></span>
                        </div>
                    </div>
                    <div class="columnPanel" >
                        <label class="tit" for="content">正文</label>
                        <div class="con">
                            <textarea id="content" name="content" v-model:value="content"></textarea>
                            <span id="contentMsg" class="note"></span>
                        </div>
                    </div>
            <div class="buttonPanel">
                <button id="submitBtn" name="method" value="save" type="button" v-on:click="save" class="jDefButton"><i class="jIcoSave"></i>确定</button>
                <input id="id" name="id" type="hidden" :value="id"/>
            </div>
        </form>
    </div>
</div>
<script>
    var app = false;
    window.addEvent('domready', function () {
        // new Calendar().cssInit();
        app = new Vue({
            el: '#helpTipForm',
            data: function () {
                var data = getFormJson("helpTipForm");
                return data;
            },
            methods: {
                loadData: function () {
                    var that = this;
                    var id = getUrlParam("id") - 0;
                    if (id <= 0) id = 0;
                    new Request.ROC({
                        'url': '/devcenter/help/detail/' + id + '.jwc',
                        onSuccess: function (obj) {
                            if (obj.success) {
                                Object.assign(that.$data, obj.data);
                                that._data = obj.data;
                                that.$forceUpdate();
                            }
                        }
                    }).send();
                },
                save: function () {
                    var posts = getFormJson("helpTipForm");
                    //添加接口
                    var url = '/devcenter/help/save.jwc';
                    new Request.ROC({
                        'url': url,data:posts,
                        onSuccess: function (obj) {
                            if (obj.success == 1) {
                                new JDialog.Pop({
                                    title: '提示信息',
                                    message: obj.message
                                }).show();
                            } else {
                                new JDialog.Alert({
                                    title: '提示信息',
                                    message: obj.message
                                }).show();
                            }
                        }
                    }).post();
                }
            }
            ,
            mounted: function () {
                this.loadData();
            }
        });
    });
</script>
</body>
</html>
